<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<!-- 下拉框 -->
<link rel="stylesheet" href="/static/ace/css/chosen.css" />
<!-- 日期框 -->
<link rel="stylesheet" href="/static/ace/css/datepicker.css" />
<script src="http://libs.baidu.com/jquery/2.0.0/jquery.js"></script>
<link rel="stylesheet" href="/layui/css/layui.css">
<script src="/layui/layui.js"></script>
<script src="/static/ace/js/bootbox.js"></script>
<!-- ace scripts -->
<!-- 下拉框 -->
<script src="/static/ace/js/chosen.jquery.js"></script>
<!-- 日期框 -->
<script src="/static/ace/js/date-time/bootstrap-datepicker.js"></script>
<link rel="stylesheet" href="https://demo.easyweb.vip/iframe/assets/module/admin.css?v=318"/>
<script type="text/javascript" src="https://demo.easyweb.vip/iframe/assets/js/common.js?v=318"></script>
<!--提示框-->
<script type="text/javascript" src="/static/js/jquery.tips.js"></script>
<style type="text/css">
.layui-table-tips-main {
	display: none
}

.layui-table-tips-c {
	display: none
}
</style>
</head>
<body class="layui-layout-body"
	style="overflow-y: auto; overflow-x: hidden;">
	<form class="layui-form" style="padding: 10px 50px 10px 10px;">
		<div class="layui-form-item">
			<div class="layui-row">
				<div class="layui-col-md4">
					<label class="layui-form-label" id="uid" th:attr="name = ${user.id}">用户姓名</label>
					<div class="layui-input-block">
						<input type="text" name="name" id="name" lay-verify="required"
							placeholder="用户姓名" autocomplete="off" class="layui-input"
							th:value="${user.name}" readonly="readonly">
					</div>
				</div>
				<div class="layui-col-md4">
					<label class="layui-form-label">用户电话</label>
					<div class="layui-input-block">
						<input type="text" name="phone" id="phone" lay-verify="required"
							placeholder="用户电话" autocomplete="off" class="layui-input"
							th:value="${user.phone}" readonly="readonly">
					</div>
				</div>
				<div class="layui-col-md4">
					<label class="layui-form-label">用户邮箱</label>
					<div class="layui-input-block">
						<input type="text" name="email" id="email" lay-verify="required"
							placeholder="用户邮箱" autocomplete="off" class="layui-input"
							th:value="${user.email}" readonly="readonly">
					</div>
				</div>
			</div>
		</div>

		<div class="layui-form-item">
			<div class="layui-col-md4">
				<label class="layui-form-label">头像地址</label>
				<div class="layui-input-block">
					<input type="text" name="img" id="img" lay-verify="required"
						placeholder="用户年龄" onkeyup="num(this)" autocomplete="off"
						class="layui-input" th:value="${user.img}" readonly="readonly">
				</div>
			</div>

			<div class="layui-col-md4">
				<label class="layui-form-label">用户年龄</label>
				<div class="layui-input-block">
					<input type="text" name="age" id="age" lay-verify="required"
						placeholder="用户年龄" onkeyup="num(this)" autocomplete="off"
						class="layui-input" th:value="${user.age}" readonly="readonly">
				</div>
			</div>
			<div class="layui-col-md4">
				<label class="layui-form-label">用户性别</label>
				<div class="layui-input-block">
					<input type="text" name="sex" id="sex" lay-verify="required"
						placeholder="用户性别" onkeyup="num(this)" autocomplete="off"
						class="layui-input"
						th:value="${user.sex==0?'保密':user.sex==1?'男':'女'}"
						readonly="readonly">
				</div>
			</div>

		</div>

		<div class="layui-form-item">
			<div class="layui-col-md4" th:if="${user.jurisdiction==0}">
				<label class="layui-form-label">用户年级</label>
				<div class="layui-input-block" id="grade">
					<input type="text" name="school" id="school" lay-verify="required" placeholder="用户学校" 
					onkeyup="num(this)" autocomplete="off" class="layui-input"
					th:value="${user.grade==0?'未设置':user.grade==1?'初三以下':user.grade==2?'初三'
					:user.grade==3?'高一':user.grade==4?'高二':user.grade==5?'高三':'高三以上'}" readonly="readonly">
				</div>
			</div>
			<div class="layui-col-md4" th:if="${user.jurisdiction==1}">
				<label class="layui-form-label">教师学历</label>
				<div class="layui-input-block" id="grade">
					<input type="text" name="school" id="school" lay-verify="required" placeholder="教师学历" 
					onkeyup="num(this)" autocomplete="off" class="layui-input"
					th:value="${user.educationbackground}" readonly="readonly">
				</div>
			</div>
			<div class="layui-col-md4"  th:if="${user.jurisdiction==0}">
				<label class="layui-form-label">用户学校</label>
				<div class="layui-input-block">
					<input type="text" name="school" id="school" lay-verify="required"
						placeholder="用户学校" onkeyup="num(this)" autocomplete="off"
						class="layui-input" th:value="${user.school}" readonly="readonly">
				</div>
			</div>
			<div class="layui-col-md4"  th:if="${user.jurisdiction==1}">
				<label class="layui-form-label">毕业院校</label>
				<div class="layui-input-block">
					<input type="text" name="school" id="school" lay-verify="required"
						placeholder="毕业院校" onkeyup="num(this)" autocomplete="off"
						class="layui-input" th:value="${user.educationbackground}" readonly="readonly">
				</div>
			</div>
			<div class="layui-col-md4">
				<label class="layui-form-label">用户生日</label>
				<div class="layui-input-block">
					<input type="text" name="brithday" id="brithday"
						lay-verify="required" placeholder="用户生日" onkeyup="num(this)"
						autocomplete="off" class="layui-input" th:value="${user.brithday}"
						readonly="readonly">
				</div>
			</div>
		</div>
		<div class="layui-form-item">
			<div class="layui-col-md4">
				<label class="layui-form-label">注册时间</label>
				<div class="layui-input-block">
					<input type="text" name="createTime" id="createTime"
						lay-verify="required" placeholder="注册时间" onkeyup="num(this)"
						autocomplete="off" class="layui-input"
						th:value="${user.createtime}" readonly="readonly">
				</div>
			</div>
			<div class="layui-col-md4">
				<label class="layui-form-label">用户类型</label>
				<div class="layui-input-block">
					<input type="text" name="jurisdiction" id="jurisdiction"
						lay-verify="required" placeholder="用户类型" onkeyup="num(this)"
						autocomplete="off" class="layui-input"
						th:value="${user.jurisdiction==0?'学生':'教师'}" readonly="readonly">
				</div>
			</div>
			<div class="layui-col-md4">
				<label class="layui-form-label">是否申述</label>
				<div class="layui-input-block">
					<input type="text" name="isstate" id="isstate"
						lay-verify="required" placeholder="否" onkeyup="num(this)"
						autocomplete="off" class="layui-input"
						th:value="${user.isstate==0}?'否':'是'" readonly="readonly">
				</div>
			</div>
		</div>
		<div class="layui-form-item">
			<div class="layui-col-md4">
				<label class="layui-form-label">是否被举报</label>
				<div class="layui-input-block">
					<input type="text" name="isreport" id="isreport"
						lay-verify="required" placeholder="是否被举报" onkeyup="num(this)"
						autocomplete="off" class="layui-input"
						th:value="${user.isreport==0?'否':'是'}" readonly="readonly">
				</div>
			</div>
			<div class="layui-col-md3">
				<label class="layui-form-label">是否被封禁</label>
				<div class="layui-input-block">
					<input type="text" name="isbanned" id="isbanned"
						lay-verify="required" placeholder="是否被封禁" onkeyup="num(this)"
						autocomplete="off" class="layui-input"
						th:value="${user.isbanned==0?'否':'是'}" readonly="readonly">
				</div>
			</div>
		</div>
		<div class="layui-form-item layui-form-text">
			<label class="layui-form-label">个性签名</label>
			<div class="layui-input-block">
				<textarea placeholder="请输入内容" class="layui-textarea"
					readonly="readonly">[[${user.persignature}]]</textarea>
			</div>
		</div>
		
		<div style="text-align: center; margin-top: 30px; margin-bottom: 20px;">
			<span type="button" class="layui-btn layui-btn-primary"
				onclick="closeDialog();">&emsp;关闭&emsp;</span>
			<span type="button" class="layui-btn" style="background-color: #5FB878;"
				onclick="ratify();">&emsp;批准&emsp;</span>
			<span id="btnSubmit" type="button"
				class="layui-btn layui-btn-danger" lay-filter="save" onclick="unAuditData();">
				&emsp;驳回&emsp;</span>
		</div>
	</form>

	<script>
		layui
				.use(
						[ 'form', 'layedit', 'laydate' ],
						function() {
							var form = layui.form, layer = layui.layer, layedit = layui.layedit, laydate = layui.laydate;
						});
	</script>
	<script type="text/javascript">
		$(top.hangge());//关闭加载状态
	</script>
<script type="text/javascript">
function ratify(){
	let params = {};
	params.id = $("#uid").attr("name")+'';
	$.ajax( {
	        url : '/admin/account/ratify', 
	        type : 'post',
	        data: params,
	        dataType : 'json',
	        success : function(data) {
	        	if(data.code==0){
        		 layer.msg(data.msg,{icon: 1});
        	 }else{
        		 layer.msg(data.msg,{icon: 2});
        	 }
	        }
	    });
}
$("#btnSubmit").click(function(){
	let dataMessage = '<div class="layui-form-item layui-form-text"><div class=""><textarea placeholder="请输入驳回理由" class="layui-textarea" id="unratifyMessage"></textarea></div></div>'
	layer.open({
        title: '请输入驳回理由'
        ,type:1
        , area: ["300px",]
        , btn: ['确定']
        , content: dataMessage
        , yes: function (index) {
        	let params = {};
        	params.id = $("#uid").attr("name")+'';
        	let message = $("#unratifyMessage").text()+'';
        	if($.trim(message) === ''){
        		message = "你提交数据异常，管理员驳回了你的申请！";
        	}
        	params.message = message;
        	$.ajax( {
       	        url : '/admin/account/list4_del', 
       	        type : 'post',
       	        data: params,
       	        dataType : 'json',
       	        success : function(data) {
       	        	if(data.code==0){
                		 layer.msg(data.msg,{icon: 1});
    	        	 }else{
    	        		 layer.msg(data.msg,{icon: 2});
    	        	 }
       	        }
       	    });
        	layer.close(index);
        }
	});
});
function closeDialog(){
	var index = parent.layer.getFrameIndex(window.name);
	parent.layer.close(index);
}
</script>
</body>
</html>